<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //字符串不可变
        var str = 'andy';
        console.log(str);
        str = 'red';
        console.log(str);
        //因为字符串不可变 所以不要大量拼接占用内存
        var str1 = '';
        for (var i = 0; i <= 10000000000000000; i++) {
            str1 += i; //运行会卡死
        }

        console.log(str1);
    </script>
</head>

<body>

</body>

</html>